package xyx.chenweb.myapp.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import xyx.chenweb.myapp.service.UserOptionService;
import xyx.chenweb.myapp.utils.MyResponseData;

/**
 * 用户需要登录才能操作的接口
 */
@Controller
@RequestMapping("/chen/userOption")
public class UserOptionController {

    @Autowired
    private UserOptionService userOptionService;

    /**
     * 修改用户密码
     *
     * @return
     */
    @RequestMapping(value = "/changPwd", method = RequestMethod.POST)
    @ResponseBody
    public MyResponseData changePwd(@RequestParam("oldPwd") String oldPwd, @RequestParam("newPwd") String newPwd){
        return userOptionService.changePwd(oldPwd, newPwd);
    }

    /**
     * 获取用户信息
     * @return
     */
    @GetMapping("/getUserInfor")
    @ResponseBody
    public MyResponseData getUserInfo() {
        return userOptionService.userInfor();
    }


}
